import requests
import execjs
url='https://match.yuanrenxue.com/api/match/16'
headers = {
        "User-Agent": "yuanrenxue.project",
        "Cookie": "sessionid=wfqqlbjeupxzz8al2b6i40jv5afbktz5"
    }
# cookie_={
#     "sessionid":"759esu9huxhrnbiji2n56518wlis3576"
# }
with open('test.js', 'r', encoding='utf-8') as fp:
    jscode = fp.read()
func = execjs.compile(jscode)
all_sum=0
for page in range(1,6):
    m=func.call('get_r')
    params={
        'page': page,
        'm': m['m'],
        't': m['t']
    }
    response=requests.get(url,params=params,headers=headers).json()
    value_sum=0
    for da in response.get('data'):
        value_sum+=da['value']
    all_sum+=value_sum
    print(f'第{page}页和为',value_sum)
print(f'{page}页总和',all_sum)